package com.itheima.practice01;
/*
    用户登录案例
    遍历字符串案例
    统计字符次数案例
    手机号屏蔽-字符串截取
    敏感词替换-字符串替换
    切割字符串
    StringBuilder拼接字符串案例
 */

import java.util.Scanner;

public class TestDemo09 {

    public static void main(String[] args) {

        //用户登录
    //    login();

        //遍历字符串
    //    traversal();

        //

    }
/*

    public static void login() {
        String name = "慕容小葛";
        String pwd = "123456";

        Scanner sc = new Scanner(System.in);


        for (int i = 1; i <= 3; i++) {
            System.out.println("请输入用户名:");
            String userName = sc.nextLine();

            System.out.println("请输入密码:");
            String userPwd = sc.nextLine();

            if (userName.equals(name) && userPwd.equals(pwd)) {
                System.out.println("验证通过^_^!!");
                break;
            } else {
                if (i == 3) {
                    System.out.println("登录次数已达上限,请明日继续!");
                    break;
                } else {
                    System.out.println("登录失败!你还有" + (3 - i) + "次机会!!");
                    continue;
                }
            }
        }


    }

*/
/*

    public static void traversal(){

        String str="阿斯加数据时间";

        for (int i = 0; i < str.length(); i++) {

            //方法1: charAt(i)遍历
            System.out.print( str.charAt(i)+" ");

        }
        System.out.println();
        System.out.println("-------------------");

        //方法2: toCharArray();

        char[] ch=str .toCharArray();

        for (int i = 0; i < ch.length; i++) {
            System.out.println(ch[i]);
        }

    }
*/

    public static void count(){

        int numCount=0;
        int bigCount=0;
        int smaCount=0;
        Scanner sc = new Scanner(System.in);

            System.out.println("请输入字符串:");
            String str = sc.nextLine();

        for (int i = 0; i < str.length(); i++) {

            if(str.charAt(i)>='0'&&str.charAt(i)<='9'){
                numCount++;
            }else  if(str.charAt(i)>='a'&&str.charAt(i)<='z'){
                smaCount++;
            }else  if(str.charAt(i)>='A'&&str.charAt(i)<='Z'){
                bigCount++;
            }

        }

        System.out.println("数字:"+numCount);
        System.out.println("小字母:"+smaCount);
        System.out.println("大字母:"+bigCount);

        }



}
